﻿using System;
using System.Collections.Generic;
using System.Reflection;

namespace Creventive.Wpf.ShellFactory.Modules
{
    /// <summary>
    ///   Defines a catalog where all modules are loaded.
    /// </summary>
    public interface IApplicationModuleService : IEnumerable<ModuleInfo>
    {
        /// <summary>
        ///   Occurs when the modules in this catalog have been loaded.
        /// </summary>
        event EventHandler Loaded;

        /// <summary>
        ///   Gets the application modules. Will not be available until the modules are loaded.
        /// </summary>
        /// <value>The application modules.</value>
        IEnumerable<ApplicationModule> ApplicationModules { get; }

        /// <summary>
        ///   Gets the number of registered modules.
        /// </summary>
        /// <value>The count.</value>
        int Count { get; }

        /// <summary>
        ///   Gets a value indicating whether the modules in this catalog have been loaded.
        /// </summary>
        /// <value><c>true</c> if the modules have been loaded; otherwise, <c>false</c>.</value>
        bool IsLoaded { get; }

        /// <summary>
        ///   Gets the <see cref = "Creventive.Wpf.ShellFactory.Modules.ModuleInfo" /> with the specified assembly name.
        /// </summary>
        /// <value></value>
        ModuleInfo this[AssemblyName assemblyName] { get; }

        /// <summary>
        ///   Gets the <see cref = "Creventive.Wpf.ShellFactory.Modules.ModuleInfo" /> at the specified index.
        /// </summary>
        /// <value></value>
        ModuleInfo this[int index] { get; }

        /// <summary>
        ///   Gets the shell module info. Will not be available until the modules are loaded.
        /// </summary>
        /// <value>The shell module info.</value>
        ModuleInfo ShellModuleInfo { get; }
    }
}